package twt.practice.votingsystem.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import twt.practice.votingsystem.service.StudentService;
import twt.practice.votingsystem.utils.APIResponse;

@RestController
public class StudentController {

    @Autowired
    StudentService studentService;

    @PostMapping("/student")
    public APIResponse register(@RequestParam("student_name") String student_name,
                                @RequestParam("password") String password){
        return studentService.register(student_name, password);
    }

    @GetMapping("/student")
    public APIResponse login(@RequestParam("student_name") String student_name,
                             @RequestParam("password") String password){
        return studentService.login(student_name, password);
    }
}
